package se.lth.student.axisandroidcam.client;

public class Toolbox {

	public static void printDebug(String str){
		System.out.println("Toolbox: " + str);
	}
	
	public static long getTimestamp(byte[] image){
		return ((image[25] & 255L) << 24 | (image[26] & 255L) << 16 | (image[27] & 255L) << 8 | image[28] & 255L) * 1000 + (image[29] & 255L) * 10;
	}
	
	
	public static long getTimestamp2(byte[] image){
		return 1000L*((getUnsigned(image,25)<<24)+(getUnsigned(image,26)<<16)+(getUnsigned(image,27)<<8)+ (getUnsigned(image,28)))+10L*getUnsigned(image,29);
	}
	
	private static long getUnsigned(byte[] data,int pos) {
		 return data[pos]<0?256+data[pos]:data[pos];
		} 
}
